home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_400
/
422_04
/
mbasic.doc
< prev
next >
Wrap
Text File
|
1994-02-14
|
46KB
|
995 lines
Micro Basic Users Guide
I originally wrote Micro Basic in 1980 for a University Computer
Club, in which the members were building their own 8085 based systems.
Dave Dunfield
MICRO BASIC USERS GUIDE Page: 1
1. INTRODUCTION
Micro Basic was implemented with the intention of providing the
maximum amount of features and flexibility, in the minimum amount of
memory space. It is intended for use on 8080/8085/Z80 based computers
which are too small to afford the use of larger programming systems.
Currently, the Micro Basic interpreter, is 3K bytes in size. A
machine-language MONITOR and all hardware dependant I/O routines are
also included, bringing the total rom size to 4K. A minimum of 3K of
ram is required if any useful programs are to be implemented. The
interpreter only makes use of memory as it needs it, and memory can
be expanded at any time, to allow for larger programs or more array
space. Micro Basic is quite different from most other BASIC
interpreters, in particular the right to left execution of
expressions, with no operator precedence, and the use of separate
operators for EQUALS and ASSIGNMENT. These implementation decisions,
were in part, based on the language APL, which is a favorite language
of the author.
The Micro Basic rom, is assembled to go at location zero, and
occupies the range of addresses from 0000-0FFF. The software supports
a 16 line by 64 character 1K memory mapped video display, to be
located in the address range from 1000-13FF. The system RAM should
start at 1400 and may continue on up to FFFF. The keyboard should be
on a parallel input port, located as port#0, with the keystrobe
(active high) on bit#7, and ASCII data is expected on bits 0-6. The
keystrobe should remain high for as long as the key is pressed. The
serial I/O for the tape is expected to be an INTEL 8251 with the data
port mapped as port#1, and the control port as port#2. The receive
and transmit clocks should be 16x the desired speed.
On the following pages, is a brief description of Micro Basic's
commands and features.
MICRO BASIC USERS GUIDE Page: 2
2. COMMANDS
Operands to commands are as followes:
<e> - Any expression.
<v> - Any variable.
<a> - Any array variable.
<n> - Any numeric expression.
<l> - A line number.
[ ] - Optional operands.
... - Multiple extra operands allowed.
2.1 General commands
The following commands, may be entered directly from the
keyboard, or executed with a BASIC program.
CLEAR
Clears all numeric and character variables, Delete's all
arrays, and resets the control stack and data pointer.
DIM a1(<n1>)[,a2(n2)]...
Dimensions integer arrays a1, a2,... makeing them n1, n2,...
elements each. Arrays may be REDIMENSIONED with the DIM statement,
however this allocates new memory for the array, causing the old
memory used by the old array to be made unusable (until 'NEW',
'CLEAR' or a 'RUN' command is issued). Whenever an array is
dimensioned or redimensioned via DIM, it is cleared to zeros.
NOTE: Array space is allocated in memory, starting at the end of
the program source. As a result, if a line is inserted into
the program, or any line is replaced in the program, any
existing arrays will be deleted.
END
Stops the program. no messages are issued.
EXIT
Exits to the system monitor.
GOTO <line#>
Transfers program execution to the statement at the beginning
of line <line#>.
GOTO(<n>),<l1>[,<l2>]...
Transfers program execution to the statement at the beginning
of line <l1> if <n>=0, to the beginning of line <l2> if <n>=1,
etc. results in SYNTAX ERROR if <n> is greater than number of line
numbers given.
MICRO BASIC USERS GUIDE Page: 3
INPUT <v>
Requests a value for <v> from the terminal. Prompts with a
question mark "?". If <v> is a character variable, then any text
can be input. If <v> is numeric, then value supplied must be a
number or expression.
INPUT "<text>",<v>
Same as above, but prompts with <text> instead of "?". <text>
can be a null string ( INPUT "",<v> would give no prompt ).
NOTE: The value of a character variable can be used in the prompt,
but must be concatinated with <text>. EG: ' INPUT ""+A$,V '.
LET <v>=<e> (default)
Assigns the value of <e> to the variable <v>. If any lines are
found by the interpreter which do not contain a command, then they
are assumed to be LET.
LIST [<l1>][,<l2>]
Lists the program,if no operands are given, then lists the
entire program. If <l1> is given then only that line is listed. If
<l2> is also given, then lists from <l1> to <l2> inclusive.
LOAD
Loads a program from tape. Flashes a '*' in the upper
right-hand corner of the screen for every record (255 Bytes) that
is loaded.
NEW
Clears the program, variables, and arrays.
ORDER <line#>
Positions the read pointer to the start of the line <line#>.
This line must begin with a DATA statement, or a DATA ERROR will
occur.
PRINT <e>[,<e>][,<e>]...[,]
Prints the expressions on the terminal. Numeric values will be
printed with a preceding space. If a numeric expression is
preceded by a single '(', then the preceding space is not printed.
( EG: PRINT 12,(12 would display ' 1212' ). If the list of
expressions ends with a trailing comma, then no line-feed carriage
return will be printed, causing the next PRINT statement to
continue at the end of the same line.
MICRO BASIC USERS GUIDE Page: 4
PLOT <x>,<y>[,<e>][,<e>]...[,]
Same as PRINT, except cursor is positioned at column <x>, line
<y> (from the top lefthand corner of the screen), before the rest
of the operands are printed. 'PLOT <x>,<y>' with no other
operands, will position the cursor with no output.
READ <v>[,<v>]...
Reads the values for variables from data statements. An ORDER
statement must be done before the first read in a program, and
anytime that you have read all the data in a data block. A data
block, is a collection of data statements which are located
separately, with no other statements between them. If a read
statement does not read all of the data in a given data statement,
then the next read will pick up where the last one left off. If a
read statement reads beyond the end of a data statement, the it
will advance to the next statement and attempt to read from there.
REM <text>
Comment, the rest of the statement is